<template>
  <div id="app">
    <h1>{{obj.num}}</h1>
    <button @click="obj.num += 1">+1</button>
    <h2>{{msg}}</h2>
		<HelloWorld></HelloWorld>
  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue';
import mixins from '@/mixins/fun.js';

export default {
  name: 'App',
  mixins: [mixins],
  data() {
    return {
      foo: '123',
      num: 1,
      obj: {
        num: 1,
      }
    }
  },
  computed: {
    msg() {
      return 'We are the Champions!'
    },
  },

  watch: {
    // num(val, oldVal) {
    //   console.log('当前值: ', val);
    //     console.log('历史值: ', oldVal);
    // },
    obj: {
      deep: true,
      immediate: true,
      handler(val, oldVal) {
        console.log('当前值: ', val);
        console.log('历史值: ', oldVal);
      }
    }
  },

  components: {
    HelloWorld,
  },
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
